<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="Templates/DefaultTemplate.xhtml"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core">
    <ui:insert name="head-title">
        <title>Login | Merlion's ERP System</title>
    </ui:insert>
    
    <ui:define name="content">
        <h:form style="width: 60%; height: 100%; margin-left: 20%; margin-right: 20%">  
            <br/><br/>
            <p:panel id="leftpanel" header="User Log In" style="width: auto;background-color: white;filter:alpha(opacity=80);opacity: 0.8;" > 
                
                <div style="padding: 5px"/>
                
                <h:outputLabel for="username" value="Username:" />  
                <p:inputText value="#{controller.userName}"   
                        id="username" required="true" label="username" 
                        requiredMessage="Username is required."
                        style="width: 100%;"/>  
                <div style="padding: 5px"/>
                
                <p:message for="username" /> 
                <div style="padding: 5px"/>
                
                <h:outputLabel for="password" value="Password:" />  
                <p:password value="#{controller.password}" minLength = "0"  
                        id="password" required="true" label="password" feedback="false"
                        requiredMessage="Password is required."
                        style="width: 100%;"/> 
                <div style="padding: 5px"/>
                
                <p:message for="password" /> 
                <div style="padding: 5px"/>
                
                <div style="margin-left: auto; margin-right: auto; text-align: center; border: 0px;">
                    <h:panelGrid columns="3">
                        <p:commandButton value="Log In" actionListener="#{controller.login}" type="submit" ajax="true" update="leftpanel" />
                        <a href="forgetPassword.xhtml">Forget Password</a>
                        <p:ajaxStatus style="width:16px;height:16px;">   
                            <f:facet name="start">   
                                <p:graphicImage value="http://www.primefaces.org:8080/showcase/design/ajaxloading.gif" /> 
                            </f:facet> 

                            <f:facet name="complete">   
                                <h:outputText value="" />   
                            </f:facet>   
                        </p:ajaxStatus> 
                    </h:panelGrid>
                    <p:messages />
                </div>
                
            </p:panel> 
            <br/><br/>             
        </h:form>  
    </ui:define>
</ui:composition>
